package part12_命令模式_一个app控制所有家电;

/**
 * @ClassName: LightOnCommand
 * @Author: AllenSun
 * @Date: 2020/3/4 23:41
 */
public class LightOffCommand implements Command {

    //命令接收器
    LightReceiver light;

    //构造器
    public LightOffCommand(LightReceiver light) {
        this.light = light;
    }

    //聚合电灯reciver
    @Override
    public void execute() {
        //调用接受者的方法
        light.off();
    }

    @Override
    public void undo() {
        light.on();
    }
}
